fix: system prompt 引导 agent 优先用 repo_url 创建工作区 - #23
Conversation
agent 在本地找到仓库后误用 local_path 调用 setup_workspace, 但路径不在 DEFAULT_WORK_DIR 范围内被安全校验拒绝。 修改 prompt 明确:优先用 repo_url 走缓存+隔离工作区流程, local_path 仅限项目目录范围内,修改代码应创建隔离工作区。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @lishuceo's task in 1m 46s —— View job PR Review: fix/workspace-prompt-prefer-repo-url
✅ ApprovedVerdict: Clean, minimal, and correctly targeted change. No bugs, no security issues. What this PR does: The system prompt in Analysis of the three changed lines:
Why this is the right fix: The root cause is an LLM behavioral issue — the agent finds a cached bare clone at No issues found at confidence ≥ 75. |
飞书会将 github.com: 解析为超链接,agent 拿到的 URL 可能 缺少 git@ 前缀。新增 normalizeRepoUrl 自动补全 SSH 简写格式。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @lishuceo's task in 1m 51s —— View job PR Review: fix/workspace-prompt-prefer-repo-url
✅ ApprovedVerdict: Clean, well-targeted fix. No bugs or security issues found. What changed:
Cross-module trace verified:
No issues found at confidence ≥ 75. |
SDK 内部对 PermissionResult 做 Zod 校验时要求 updatedInput 为 Record 类型,省略该字段会导致 undefined 校验失败, MCP 工具 handler 不会被执行。修复:将 inputObj 原样传回。 同时为 MCP 工具 handler 添加入口日志便于排查。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @lishuceo's task in 1m 22s —— View job PR Review: fix/workspace-prompt-prefer-repo-url
✅ ApprovedVerdict: Clean, well-targeted fix. No bugs or security issues found. Changes reviewed:
Cross-module verification:
No issues found at confidence ≥ 75. |
* fix: system prompt 引导 agent 优先用 repo_url 创建工作区 agent 在本地找到仓库后误用 local_path 调用 setup_workspace, 但路径不在 DEFAULT_WORK_DIR 范围内被安全校验拒绝。 修改 prompt 明确:优先用 repo_url 走缓存+隔离工作区流程, local_path 仅限项目目录范围内,修改代码应创建隔离工作区。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: 归一化 SSH 简写 URL (github.com:user/repo → git@...) 飞书会将 github.com: 解析为超链接,agent 拿到的 URL 可能 缺少 git@ 前缀。新增 normalizeRepoUrl 自动补全 SSH 简写格式。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: canUseTool 必须返回 updatedInput 否则 SDK Zod 校验失败 SDK 内部对 PermissionResult 做 Zod 校验时要求 updatedInput 为 Record 类型,省略该字段会导致 undefined 校验失败, MCP 工具 handler 不会被执行。修复:将 inputObj 原样传回。 同时为 MCP 工具 handler 添加入口日志便于排查。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
local_path调用setup_workspace,路径不在DEFAULT_WORK_DIR范围内被安全校验拒绝,导致工作区创建失败repo_url(走缓存+隔离工作区流程),local_path仅限项目目录范围内Test plan
setup_workspace用repo_url方式能正确 clone 到.workspaces/目录repo_url参数而非local_path🤖 Generated with Claude Code